home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8719 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: news.mindlink.net!news
  2. From: genew@mindlink.bc.ca (Gene Wirchenko)
  3. Newsgroups: comp.arch.arithmetic,comp.lang.c,comp.lang.c++
  4. Subject: Re: Access carry flag from C
  5. Date: Mon, 26 Feb 1996 06:09:19 GMT
  6. Organization: MIND LINK! - British Columbia, Canada
  7. Message-ID: <4grivs$cp8@fountain.mindlink.net>
  8. References: <Dn1C9z.DGv.0.net@indra.com> <ARTHUR.96Feb20143404@gold.Smallworld.co.uk> <824853272snz@genesis.demon.co.uk> <4gqj0d$d6p@airdmhor.gen.nz>
  9. NNTP-Posting-Host: line070.nwm.mindlink.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. gumboot@airdmhor.gen.nz (Simon Hosie) wrote:
  13.  
  14. >Lawrence Kirby:
  15. >> It certainly can be done portably although not with the efficiency that
  16. >> a platform-specific solution is likely to give you.
  17.  
  18. >>     int j, k;
  19.  
  20. >>     ...
  21.  
  22. >>     if ((j >= 0) ? (k > INT_MAX-j) : (k < INT_MIN-j))
  23. >                     ^^^^^^^^^^^^^^^   ^^^^^^^^^^^^^^^
  24. >  Won't they both be evaluated?
  25.  
  26.      No.  Ref: K&R2, p 51.  [slight change in presentation: no
  27. italics, etc.]
  28.  
  29.      "In the expression
  30.  
  31.           exptr1 ? expr2 : expr3
  32.  
  33. the expression expr1 is evaluated first.  ...  Only one of expr2 and
  34. expr3 is evaluated."
  35.  
  36.      K&R2 is cheap and good.  Buy a copy.
  37.  
  38. Sincerely,
  39.  
  40. Gene Wirchenko
  41.  
  42. C Pronunciation Guide:
  43.      y=x++;     "wye equals ex plus plus semicolon"
  44.      x=x++;     "ex equals ex doublecross semicolon"
  45.  
  46.